<%@page import="sun.jdbc.rowset.CachedRowSet"%>
<%@page import="monster.comm.database.DBManager"%>
<%@page import="monster.comm.util.Tool"%>
<%@page contentType="text/html; charset=utf-8"%>
<%
	String path = request.getContextPath();
	String now_time = Tool.getRequest("now_time", request);
	String squadron_no = Tool.getRequest("squadron_no", request);//所在中队
	
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
	<head>
		<title>随机安排</title>
		<meta http-equiv="content-type" content="text/html; charset=utf-8" />
		<meta http-equiv="imagetoolbar" content="no" />
		<meta name="apple-mobile-web-app-capable" content="yes" />
		<link href="<%=path%>/comm/resources/css/jquery-ui-themes.css"
			type="text/css" rel="stylesheet" />
		<link href="<%=path%>/comm/resources/css/axure_rp_page.css"
			type="text/css" rel="stylesheet" />
		<link href="<%=path%>/comm/css/work/axurerp_pagespecificstyles.css"
			type="text/css" rel="stylesheet" />
		<!--[if IE 6]>
		    <link href="<%=path%>/comm/css/work/axurerp_pagespecificstyles_ie6.css" type="text/css" rel="stylesheet">
		<![endif]-->
		<script src="<%=path%>/comm/js/data/sitemap.js"></script>
		<script src="<%=path%>/comm/resources/scripts/jquery-1.7.1.min.js"></script>
		<script src="<%=path%>/comm/resources/scripts/axutils.js"></script>
		<script	src="<%=path%>/comm/resources/scripts/jquery-ui-1.8.10.custom.min.js"></script>
		<script src="<%=path %>/comm/plug/dialog/artDialog.js?skin=idialog"></script>
		<script src="<%=path %>/comm/plug/dialog/iframeTools.js?skin=idialog"></script>
		<script>
		var path="<%=path%>";
		var flight_id="";
		var flight_date="";
		var std="";
		var staff_sn="";
		var type="2";//随机
		$(function(){
			$("#name").bind("blur",function(){
				if($(this).val()==""){
					return;
				}
				checkStaffName($(this).val());
			});
			queryPlan();
			
		});
		function checkStaffName(staff_name){
			staff_sn="";
			$.post(path+"/dynamicTips/checkstaffname.jsp",
					{
						staff_name:staff_name
					},
					function(data){
						if(data.id==100){								
							staff_sn = data.list[0]["staff_sn"];	
							
						}else if(data.id==101){
							art.dialog.alert("不存在人员!");
						}else if(data.id==-200){
							art.dialog.alert("程序异常!");
						}else if(data.id==-100){
							art.dialog.alert("请重新登录!");
						}
					},
					"json"
					);
		}
		
		function delPlan(sn){
			
			$.post(path+"/dynamicTips/delplan.jsp",
					{
						type:type,
						sn:sn
					},
					function(data){
						if(data.id==100){								
							art.dialog.alert("删除成功!");
							queryPlan();
						}else if(data.id==-200){
							art.dialog.alert("程序异常!");
						}else if(data.id==-100){
							art.dialog.alert("请重新登录!");
						}
					},
					"json"
					);
		}
		function savePlan(){
			
			$("#u8").attr("disabled",true);
			var str="";
			if(staff_sn==""){
				str+="名字不存在!";
			}
			if($("#name").val()==""){
				str+="名字不能为空!";
			}
			if($("#s_n").val()==""){
				str+="开始时间年不能为空!";
			}
			if($("#s_m").val()==""){
				str+="开始时间月不能为空!";
			}
			if($("#s_d").val()==""){
				str+="开始时间日不能为空!";
			}
			if($("#s_h").val()==""){
				str+="开始时间小时不能为空!";
			}			
			if($("#e_n").val()==""){
				str+="结束时间年不能为空!";
			}
			if($("#e_m").val()==""){
				str+="结束时间月不能为空!";
			}
			if($("#e_d").val()==""){
				str+="结束时间日不能为空!";
			}
			if($("#e_h").val()==""){
				str+="结束时间小时不能为空!";
			}
			if($("#station_place").val()==""){
				str+="驻站地点不能为空!";
			}
			
			if(str!=""){
				art.dialog.alert(str);
				$("#u8").attr("disabled",false);
				return;
			}
			$.post(path+"/dynamicTips/saveplan.jsp",
					{
						type:type,
						staff_name:$("#name").val(),
						staff_sn:staff_sn,
						st:$("#s_n").val()+"-"+$("#s_m").val()+"-"+$("#s_d").val()+"-"+$("#s_h").val(),
						et:$("#e_n").val()+"-"+$("#e_m").val()+"-"+$("#e_d").val()+"-"+$("#e_h").val(),
						station_place:$("#station_place").val()
					},
					function(data){
						if(data.id==100){								
							queryPlan();
							
						}else if(data.id==-200){
							art.dialog.alert("程序异常!");
						}else if(data.id==-100){
							art.dialog.alert("请重新登录!");
						}
						$("#u8").attr("disabled",false);
					},
					"json"
					);
		}
		 function queryPlan(){
			 $.post(path+"/dynamicTips/qureyplan.jsp",
						{
							type:type
						},
						function(data){
							if(data.id==100){								
									var op="";
									for(var i in data.list){
										op+='<div style="float:left;margin-top: 6px">'
										+'<div style="float: left;margin-left: 2px;">'
										+'	<p style="text-align: left;">'
										+'		<span style="font-family: Arial; font-size: 13px; font-weight: normal; font-style: normal; text-decoration: none; color: #333333;">'+data.list[i]['staff_name']+'</span>'
										+'	</p>'
										+'</div>'
										+'<div style="float: left;margin-left: 26px;">'
										+'	<p style="text-align: left;">'
										+'		<span	style="font-family: Arial; font-size: 13px; font-weight: normal; font-style: normal; text-decoration: none; color: #000000;">'+data.list[i]['t_name']+'</span>'
										+'	</p>'
										+'</div>'
										+'<div style="float: left;margin-left: 26px;">'
										+'	<p style="text-align: left;">'
										+'		<span	style="font-family: Arial; font-size: 13px; font-weight: normal; font-style: normal; text-decoration: none; color: #000000;">'+data.list[i]['st']+'</span>'
										+'	</p>'
										+'</div>'
										+'<div style="float: left;margin-left: 26px;">'
										+'	<p style="text-align: left;">'
										+'		<span	style="font-family: Arial; font-size: 13px; font-weight: normal; font-style: normal; text-decoration: none; color: #333333;">'+data.list[i]['et']+'</span>'										
										+'	</p>'
										+'</div>'
										+'<div style="float: left;margin-left: 28px;">'
										+'	<p style="text-align: left;">'
										+'		<span   style="font-family: Arial; font-size: 13px; font-weight: normal; font-style: normal; text-decoration: none; color: #333333;">'+data.list[i]['re']+'</span>'
										+'	</p>'
										+'</div>'
										+'<div style="float: left;margin-left: 28px;">'
										+'	<p style="text-align: left;">'
										+'		<span   style="font-family: Arial; font-size: 13px; font-weight: normal; font-style: normal; text-decoration: none; color: #333333;">'
										+'<a href="javascript:void(0);" onclick="delPlan('+data.list[i]['sn']+')">删除</a></span>'
										+'	</p>'
										+'</div>'
										+'</div>'
									}
									$("#u13container").html(op);				
								
								
							}else if(data.id==-200){
								alert("程序异常!");
							}else if(data.id==-100){
								alert("请重新登录!");
							}
						},
						"json"
						);
		 }
		</script>
	</head>
	<body>
		<div id="main_container">
			<div id="u0" class="u0_container">
				<div id="u0_img" class="u0_normal detectCanvas"></div>
				<div id="u1" class="u1" style="visibility: hidden;">
					<div id="u1_rtf"></div>
				</div>
			</div>			
			<div id="u4" class="u4">
				<div id="u4_rtf">
					<p style="text-align: left;">
						<span
							style="font-family: Arial; font-size: 13px; font-weight: bold; font-style: normal; text-decoration: none; color: #333333;">姓名</span>
					</p>
				</div>
			</div>
			<div id="u6" class="u6">
				<div id="u6_rtf">
					<p style="text-align: left;">
						<span
							style="font-family: Arial; font-size: 13px; font-weight: bold; font-style: normal; text-decoration: none; color: #333333;">开始时间（年月日小时）</span>
					</p>
				</div>
			</div>
			<div id="u366" class="u366">
				<div id="u366_rtf">
					<p style="text-align: left;">
						<span style="font-family: Arial; font-size: 13px; font-weight: bold; font-style: normal; text-decoration: none; color: #333333;">结束时间（年月日小时）</span>
					</p>
				</div>
			</div>
			<INPUT  id="name" type=text value="姓名" class="u3">
			<INPUT  id="s_n" type=text value="年" class="u5">			
			<INPUT  id="s_m" type=text value="月" class="u363">
			<INPUT  id="s_d" type=text value="日" class="u364">			
			<INPUT  id="s_h" type=text value="小时" class="u367">

			<INPUT id="e_n" type=text value="年" class="u368">

			<INPUT id="e_m" type=text value="月" class="u370">

			<INPUT id="e_d" type=text value="日" class="u371">
			<INPUT id="e_h" type=text value="小时" class="u373">
			
		
			<div id="u2" class="u2">
				<div id="u2_rtf">
					<p style="text-align: left;">
						<span style="font-family: Arial; font-size: 13px; font-weight: bold; font-style: normal; text-decoration: none; color: #333333;">驻站地点</span>
					</p>
				</div>
			</div>
			
			
			

			<INPUT id="station_place" type=text value="地点" class="u9">
			
			<INPUT id="u8" type="button" onclick="savePlan()" class="u8" value="新增">
			<DIV id="u12" >
				<DIV id="pd0u12" >
					<DIV id="u13" class="u13;">

					</DIV>

					<DIV id="u13container"	style="position: absolute; left: 0px; top: 0px; width: 540px; height: 570px; overflow: visible;background-color: white;">
							<div style="float:left;margin-top: 6px">
									<div style="float: left;margin-left: 2px;">
										<p style="text-align: left;">
											<span style="font-family: Arial; font-size: 13px; font-weight: normal; font-style: normal; text-decoration: none; color: #333333;">李小山</span>
										</p>
									</div>										
									<div style="float: left;margin-left: 26px;">
										<p style="text-align: left;">
											<span	style="font-family: Arial; font-size: 13px; font-weight: normal; font-style: normal; text-decoration: none; color: #000000;">随机</span>
										</p>
									</div>
									<div style="float: left;margin-left: 26px;">
										<p style="text-align: left;">
											<span	style="font-family: Arial; font-size: 13px; font-weight: normal; font-style: normal; text-decoration: none; color: #000000;">2013-9-02 8:00</span>
										</p>
									</div>
									<div style="float: left;margin-left: 26px;">
										<p style="text-align: left;">
											<span	style="font-family: Arial; font-size: 13px; font-weight: normal; font-style: normal; text-decoration: none; color: #333333;">2013-9-15 16:00</span>										
										</p>
									</div>
									<div style="float: left;margin-left: 28px;">
										<p style="text-align: left;">
											<span   style="font-family: Arial; font-size: 13px; font-weight: normal; font-style: normal; text-decoration: none; color: #333333;">3U8889</span>
										</p>
									</div>
									<div style="float: left;margin-left: 28px;">
										<p style="text-align: left;">
											<span   style="font-family: Arial; font-size: 13px; font-weight: normal; font-style: normal; text-decoration: none; color: #333333;">删除</span>
										</p>
									</div>
							</div>		

					</DIV>
				</DIV>
			</DIV>
			<div id="u350" class="u350_container">
				<div id="u350_img" class="u350_normal detectCanvas"></div>
				<div id="u351" class="u351">
					<div id="u351_rtf">
						<p style="text-align: center;">
							<span
								style="font-family: Arial; font-size: 13px; font-weight: bold; font-style: normal; text-decoration: none; color: #333333;">姓名</span>
						</p>
					</div>
				</div>
			</div>
			<div id="u360" class="u360_container">
				<div id="u360_img" class="u360_normal detectCanvas"></div>
				<div id="u361" class="u361">
					<div id="u361_rtf">
						<p style="text-align: center;">
							<span
								style="font-family: Arial; font-size: 13px; font-weight: bold; font-style: normal; text-decoration: none; color: #333333;">性质</span>
						</p>
					</div>
				</div>
			</div>
			<div id="u352" class="u352_container">
				<div id="u352_img" class="u352_normal detectCanvas"></div>
				<div id="u353" class="u353">
					<div id="u353_rtf">
						<p style="text-align: center;">
							<span
								style="font-family: Arial; font-size: 13px; font-weight: bold; font-style: normal; text-decoration: none; color: #333333;">开始时间</span>
						</p>
					</div>
				</div>
			</div>
			<div id="u354" class="u354_container">
				<div id="u354_img" class="u354_normal detectCanvas"></div>
				<div id="u355" class="u355">
					<div id="u355_rtf">
						<p style="text-align: center;">
							<span
								style="font-family: Arial; font-size: 13px; font-weight: bold; font-style: normal; text-decoration: none; color: #333333;">结束时间</span>
						</p>
					</div>
				</div>
			</div>
			<div id="u356" class="u356_container">
				<div id="u356_img" class="u356_normal detectCanvas"></div>
				<div id="u357" class="u357">
					<div id="u357_rtf">
						<p style="text-align: center;">
							<span
								style="font-family: Arial; font-size: 13px; font-weight: bold; font-style: normal; text-decoration: none; color: #333333;">驻站地点</span>
						</p>
					</div>
				</div>
			</div>
			<div id="u358" class="u358_container">
				<div id="u358_img" class="u358_normal detectCanvas"></div>
				<div id="u359" class="u359">
					<div id="u359_rtf">
						<p style="text-align: center;">
							<span
								style="font-family: Arial; font-size: 13px; font-weight: bold; font-style: normal; text-decoration: none; color: #333333;">操作</span>
						</p>
					</div>
				</div>
			</div>
		</div>
			
	</body>
</html>